<?php
/**
 * Created by sublime 3.
 * Auth: Inhere
 * Date: 14-12-12
 * Time: 10:35
 * Uesd: 主要功能是 hi
 */
namespace ulue\parts\session\handler;

use ulue\parts\db\AbstractDbCore;


class DbSessionHandler extends AbstractSessionHandler
{
    protected $db       = null;

    protected $options  = [
        'table'     => 'ulue_sessions',
        'key_col'   => 'key',
        'data_col'  => 'data',
        'time_col'  => 'time',
    ];

    public function __construct(AbstractDbCore $db, array $options=[])
    {
        $this->db      = $db;
        $this->options = array_merge($this->options, $options);
    }

    static public function isSupported()
    {
        return true;
    }

    public function open($path, $name)
    {
        return true;
    }

    public function  read( $id )
    {
        return true;
    }

    public function  write( $id ,  $data )
    {
        return true;
    }

    public function  destroy ( $id )
    {
        return  true ;
    }

    public function gc($maxlifetime)
    {
        return true;
    }

    public function close()
    {
//        $this->gc($this->lasttime);
        return true;
    }
}